package Day07.demo2;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chihb
 * @create-time 2024/7/4 11:51
 * @description
 */
public class Test {
    public static void main(String[] args) {
        List<Student> list=new ArrayList<>();
        list.add(new Student(1, "张无忌", "河北"));
        list.add(new Student(2, "张三丰", "河南"));
        list.add(new Student(3, "赵敏", "蒙古"));
        list.add(new Student(4, "周芷若", "四川"));
        for (int i = 0; i < list.size(); i++) {
            if(list.get(i).getName().equals("张三丰")){
                list.get(i).setAddress("山东");
            }
        }
        list.forEach(System.out::println);
    }
}
